﻿'use strict';
(function () {
    // 注意JS的绑定顺序，第一组绑定的文件可以用angular.module('MyControllers', []);，后续的文件只能用angular.module('MyControllers')
    var service = angular.module('MyServices');

    service.factory('examReportService', ['$http', function (http) {
        var methods = {
            // 考试计划
            examPlanSrv: {
                getList: function (type) {
                    return http.post('/ExamReport/GetList/', { planType: type ,account : commonFun.getCookie('account') });
                },
                getSignInReport: function (planId) {
                    return http.post('/ExamReport/GetSignInReport/', { planId: planId });
                }
            },
            // 统考服务
            tradExamSrv: {
                getSceneList: function (planId, roomId, subjectId) {
                    return http.post('/ExamPlan/GetSceneList/', { planId: planId, roomId: roomId, subjectId: subjectId });
                },
                getRoomList: function (planId, sceneId, subjectId) {
                    return http.post('/ExamPlan/GetRoomList/', { planId: planId, sceneId: sceneId, subjectId: subjectId });
                },
                getSubjectList: function (planId, sceneId, roomId) {
                    return http.post('/ExamPlan/GetSubjectList/', { planId: planId, sceneId: sceneId, roomId: roomId });
                },
                getList: function (planId, sceneId, roomId, subjectId, statusId) {
                    return http.post('/ExamReport/GetExamReportList/', { planId: planId, sceneId: sceneId, roomId: roomId, subjectId: subjectId, statusId: statusId });
                },
                getExamReportDetail: function (planId, sceneId, roomId, subjectId, examineeId) {
                    return http.post('/ExamReport/GetExamReportDetail/', { planId: planId, sceneId: sceneId, roomId: roomId, subjectId: subjectId, examineeId: examineeId });
                },
                buildExamReport: function (planId, sceneId, roomId, subjectId) {
                    return http.post('/ExamReport/BuildExamReport/', { planId: planId, sceneId: sceneId, roomId: roomId, subjectId: subjectId });
                },
                upload: function (planId, reportIdList) {
                    return http.post('/ExamReport/ExamUpload/', { planId: planId, reportIdList: reportIdList });
                },
                download: function (planId, reportIdList) {
                    return http.post('/ExamReport/ExamDownload/', { planId: planId, reportIdList: reportIdList });
                },
                uploadResultPackage: function (path) {
                    return http.post('/ExamReport/UploadResultPackage/', { filePath: path });
                }
            },
            // 随考服务
            freeExamSrv: {
                getSubjectList: function (planId, currentPage, pageSize, examResult, upload) {
                    return http.post('/ExamReport/findFreeExamSubjectReportList/', { examPlanID: planId, examResult: examResult, upload: upload, currentPage: currentPage, pageSize: pageSize });
                },
                getList: function (planId, subjectId, parameter) {
                    return http.post('/ExamReport/GetFreeExamReportList/', { planId: planId, subjectId: subjectId, parameter: parameter });
                },
                getGeneratedList: function (planId) {
                    return http.post('/ExamReport/GetGeneratedList/', { planId: planId });
                },
                buildFreeExamReport: function (planId, subjectId) {
                    return http.post('/ExamReport/BuildFreeExamReport/', { planId: planId, subjectId: subjectId });
                },
                upload: function (planId, selList) {
                    return http.post('/ExamReport/FreeExamUpload/', { planId: planId, subjectIdList: selList });
                },
                download: function (planId, selList) {
                    return http.post('/ExamReport/FreeExamDownload/', { planId: planId, selList: selList });
                },
                //uploadResultPackage: function (path) {
                //    return http.post('/ExamReport/uploadResultPackage/', { filePath: path });
                //},
                uploadResultPackage: function (examResultList) {
                    return http.post('/ExamReport/UploadResultPackage/', { examResultList: examResultList });
                }
            }
        };
        return methods;
    }]);
})();